﻿<UserControl x:Class="eNursePHR.userInterfaceLayer.CCCTaxonomyControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dat="clr-namespace:System.Windows.Data;assembly=PresentationFramework"
    xmlns:ui="clr-namespace:eNursePHR.userInterfaceLayer"
Background="{DynamicResource BlueTheme}"
             >
    <UserControl.Resources>
       <!-- Converters -->
        <ui:DateConverter x:Key="DateConverter"/>
        <ui:RemoveParentesisOutcomeConceptConverter x:Key="RemoveParentesisOutcomeConceptConverter" />

       <!-- Datatemplates -->
        <DataTemplate x:Key="ccTemplateOutcomeType">

            <StackPanel Orientation="Horizontal">
                <TextBlock Text="will" Margin="0,0,5,0" />
                <TextBlock x:Name="tbTemplateConceptOutcomeType" Text="{dat:Binding Path=Concept, Converter={StaticResource RemoveParentesisOutcomeConceptConverter}}" 
                HorizontalAlignment="Left"  Foreground="{StaticResource DiagnosisColor}"
                FontWeight="UltraBold" TextWrapping="Wrap" ToolTip="{dat:Binding Path=Definition}" />
                <!-- <TextBlock Text="{Binding Path=Definition}" HorizontalAlignment="Left"  TextWrapping="Wrap" /> -->
            </StackPanel>

        </DataTemplate>
        <DataTemplate x:Key="ccTemplateDiagnosisAndIntervention">

            <StackPanel>
                <TextBlock x:Name="tbTemplateConceptActionType" Text="{dat:Binding Path=Concept}" 
                HorizontalAlignment="Left" 
                FontWeight="UltraBold" TextWrapping="Wrap" ToolTip="{dat:Binding Path=Definition}" />
                <!--  <TextBlock Text="{Binding Path=Definition}" HorizontalAlignment="Left"  TextWrapping="Wrap" /> -->
            </StackPanel>

        </DataTemplate>



    </UserControl.Resources>
        <ScrollViewer  
     ScrollViewer.VerticalScrollBarVisibility="Auto" MaxHeight="600" >
        <StackPanel>

                <StackPanel Orientation="Horizontal"  >
                    <!-- LANGAUGE attrib change
                                                Norwegian : Søk
                                                English : Search -->
                    <Label HorizontalAlignment="Left" Foreground="#FF000000" VerticalAlignment="Center" Content="Search :"/>
                    <TextBox Width="100" x:Name="tbSearch" TextChanged="tbSearch_TextChanged" VerticalContentAlignment="Center" VerticalAlignment="Center"  />
                    <ComboBox x:Name="cbLanguage" Width="60" 
											   SelectionChanged="cbLanguage_SelectionChanged"
											   VerticalAlignment="Center" HorizontalAlignment="Right" Margin="2" >
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <Image x:Name="imgFlagCombo" Width="40" />
                                    <!--<Image x:Name="imgPassed" Margin="5,0,0,0" Width="10" VerticalAlignment="Center" />-->
                                </StackPanel>
                                <DataTemplate.Triggers>

                                    <!-- Norwegian -->
                                    <DataTrigger Binding="{dat:Binding Path=Language_Name}" Value="nb-NO">
                                        <Setter Property="Source" Value="Flags/nb-No.gif" TargetName="imgFlagCombo" />

                                    </DataTrigger>

                                    <!-- American -->
                                    <DataTrigger Binding="{dat:Binding Path=Language_Name}" Value="en-US">
                                        <Setter Property="Source" Value="Flags/en-US.gif" TargetName="imgFlagCombo" />

                                    </DataTrigger>

                                    <!-- Korean -->
                                    <DataTrigger Binding="{dat:Binding Path=Language_Name}" Value="ko-KR">
                                        <Setter Property="Source" Value="Flags/ko-KR.gif" TargetName="imgFlagCombo" />

                                    </DataTrigger>

                                    <!-- Turkish -->
                                <DataTrigger Binding="{dat:Binding Path=Language_Name}" Value="tr-TR">
                                    <Setter Property="Source" Value="Flags/tr-TR.gif" TargetName="imgFlagCombo" />
                                </DataTrigger>
                                    
                                <!-- Spanish -->
                                    <DataTrigger Binding="{dat:Binding Path=Language_Name}" Value="es-EC">
                                        <Setter Property="Source" Value="Flags/es-EC.gif" TargetName="imgFlagCombo" />

                                    </DataTrigger>

                                    <DataTrigger Binding="{dat:Binding Path=ValidShallow}" Value="True">
                                        <Setter Property="ToolTip" Value="Passed language integrity shallow test (everthing as the expected count)" TargetName="imgFlagCombo" />
                                        <!--<Setter Property="Source" Value="Images/OK.png" TargetName="imgPassed" />-->

                                    </DataTrigger>
                                    <DataTrigger Binding="{dat:Binding Path=ValidShallow}" Value="False">
                                        <Setter Property="ToolTip" Value="Did not pass the language integrity shallow test (something not as the expected count) " TargetName="imgFlagCombo" />
                                        <!--<Setter Property="Source" Value="Images/ERROR.png" TargetName="imgPassed" />-->

                                    </DataTrigger>


                                </DataTemplate.Triggers>
                            </DataTemplate>

                        </ComboBox.ItemTemplate>

                    </ComboBox>

                </StackPanel>
        

                <Expander x:Name="exFramework"  IsExpanded ="True" Foreground="#FF000000" >

                <Expander.Header>
                    <StackPanel>
                        <StackPanel Margin="5,0,0,0"  x:Name="spCopyright" Orientation="Horizontal">
                            <StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock x:Name="tbFrameworkName" Text="{dat:Binding Path=Name}"  />
                                    <TextBlock Margin="5,0,0,0" x:Name="tbFrameworkVersion" Text="{dat:Binding Path=Version}"   />
                                </StackPanel>

                                <TextBlock x:Name="tbFrameworkAuthors" Text="{dat:Binding Path=Authors}" Foreground="#FF000000" />
                                <TextBlock x:Name="tbFrameworkLastUpdate" Text="{dat:Binding Path=LastUpdate, Converter={StaticResource DateConverter}}" Foreground="#FF000000" />
                            </StackPanel>

                            <Image x:Name="imgLogo"  Height="20" Source="{dat:Binding Path=LogoURL}" VerticalAlignment="Center"/>

                        </StackPanel>



                    </StackPanel>
                </Expander.Header>

                <StackPanel>




                    <!-- Care Components -->

                    <Expander  IsExpanded="True">

                        <Expander.Header>
                            <TextBlock Text="Care Components" Background="{StaticResource BrushFrameworkCareComponent}" />
                        </Expander.Header>
                        <StackPanel>
                            <!-- LANGAUGE attrib change 
    Norwegian: "Ingen omsorgs komponenter funnet!"
    English : "No care components found!"
    -->
                            <Label x:Name="lblNoMatchCareComponent" Visibility="Collapsed" Content="No care components found!"/>
                            <StackPanel x:Name="spCareComponent">

                                <ContentControl Margin="5" x:Name="ccCareComponent"
                                             PreviewMouseLeftButtonDown="ccCareComponent_MouseDown"
                                                     >
                                    <ContentControl.ContentTemplate>
                                        <DataTemplate>
                                            <Border BorderThickness="1" Background="White" x:Name="ccCareComponentBorder" 
                                                        MouseEnter="ccFrameworkElement_MouseEnter" 
                                                        MouseLeave="ccFrameworkElement_MouseLeave" >
                                                <StackPanel>
                                                    <TextBlock Text="{dat:Binding Path=Component}"
                                                         FontWeight="Bold" Foreground="{StaticResource CareComponentColor}" />
                                                    <TextBlock Text="{dat:Binding Path=Definition}" TextWrapping="Wrap" />
                                                </StackPanel>

                                            </Border>

                                        </DataTemplate>
                                    </ContentControl.ContentTemplate>
                                </ContentControl>



                                <ListBox x:Name = "lbCareComponent" 
                                            Margin="5" 
					                        ScrollViewer.HorizontalScrollBarVisibility="Disabled"
						                    SelectionChanged="lbCareComponent_SelectionChanged"
                                             
					                        
                                              >
                                    <!-- <Label FontWeight="Bold">Omsorgs komponent</Label> -->

                                    <ListBox.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <!-- <StackPanel Orientation="Horizontal" /> -->
                                            <WrapPanel />

                                        </ItemsPanelTemplate>
                                    </ListBox.ItemsPanel>
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{dat:Binding Path=Component}" 
                                                           ToolTip="{dat:Binding Path=Definition}"
                                                           Width="110" />

                                        </DataTemplate>
                                    </ListBox.ItemTemplate>

                                    <ListBox.GroupStyle>
                                        <GroupStyle>
                                            <GroupStyle.HeaderTemplate>
                                                <DataTemplate>
                                                    <TextBlock FontWeight="Bold" FontSize="15"
											Text="{dat:Binding Path=Name}"/>
                                                </DataTemplate>
                                            </GroupStyle.HeaderTemplate>
                                        </GroupStyle>
                                    </ListBox.GroupStyle>


                                </ListBox>

                            </StackPanel>
                        </StackPanel>

                    </Expander>


                    <!-- Outcome Types -->

                    <!-- LANGAUGE attrib change-->

                    <Expander IsExpanded="False">
                        <Expander.Header>
                            <TextBlock Text="Expected outcome" Background="{StaticResource BrushFrameworkDiagnosis}" />
                        </Expander.Header>

                        <StackPanel>

                            <Border Margin="5" BorderThickness="1" 
                                    MouseEnter="ccFrameworkElement_MouseEnter"
                                    MouseLeave="ccFrameworkElement_MouseLeave"
                                    Background="White"
                                    HorizontalAlignment="Left"
                                    >
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
                                    <ContentControl Margin="5,0,0,0" x:Name="ccOutcomeType"
                                                ContentTemplate="{StaticResource ccTemplateOutcomeType}"
                                                PreviewMouseLeftButtonDown="ccOutcomeType_MouseDown"/>
                                    <Image Margin="5,0,0,0" Source="{dat:Binding Path=Source, ElementName=imgOutcomeType}"  Height="15" />

                                </StackPanel>
                            </Border>

                            <ListBox x:Name = "lbOutcomeType"  
                                                 Margin="5"
                                                 Width="130"
						 	                    MaxHeight="300"
						 	                    HorizontalAlignment="Left"
                                         
                                         IsSynchronizedWithCurrentItem="True" 
                                     SelectionChanged="lbOutcomeType_SelectionChanged">


                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <Image x:Name="imgOutcomeType" Width="15" Height="15"  />
                                            <TextBlock Margin="5,0,0,0" Text ="{dat:Binding Path=Concept, Converter={StaticResource RemoveParentesisOutcomeConceptConverter}}" ToolTip="{dat:Binding Path=Definition}" Padding="5,0,0,0" />

                                        </StackPanel>
                                        <DataTemplate.Triggers>
                                            <DataTrigger Binding="{dat:Binding Path=Code}" Value="1">
                                                <Setter TargetName="imgOutcomeType" Property="Source" Value="Outcome Types\Improved.png" />
                                            </DataTrigger>
                                            <DataTrigger Binding="{dat:Binding Path=Code}" Value="2">
                                                <Setter TargetName="imgOutcomeType" Property="Source" Value="Outcome Types\Stabilized.png" />
                                            </DataTrigger>
                                            <DataTrigger Binding="{dat:Binding Path=Code}" Value="3">
                                                <Setter TargetName="imgOutcomeType" Property="Source" Value="Outcome Types\Worsened.png" />
                                            </DataTrigger>
                                        </DataTemplate.Triggers>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>

                            </ListBox>

                            <CheckBox Margin="5" x:Name="cbAttachToDiagnosis" 
                                      Content="Attach to diagnosis" 
                                      IsChecked="False" 
                                      Checked="cbAttachToDiagnosis_Checked"
                                      Unchecked="cbAttachToDiagnosis_UnChecked"/>




                        </StackPanel>

                    </Expander>


                    <!-- Diagnoses -->
                    <!-- LANGAUGE attrib change-->

                    <Expander IsExpanded="True" >
                        <Expander.Header>
                            <TextBlock Text="Diagnoses" Background="{StaticResource BrushFrameworkDiagnosis}" HorizontalAlignment="Stretch" />
                        </Expander.Header>

                        <StackPanel>
                            <!-- LANGAUGE attrib change-->

                            <Label x:Name="lblNoMatchNursingDiagnoses" Visibility="Collapsed" Content="No diagnoses found!"/>


                            <StackPanel x:Name="spNursingDiagnoses" Margin="5">

                                <GroupBox Header="Reason">
                                    <StackPanel Margin="5">
                                        <Border PreviewMouseLeftButtonDown="ccNursingDiagnosis_MouseDown"
                                        MouseEnter="ccFrameworkElement_MouseEnter" 
                                        MouseLeave="ccFrameworkElement_MouseLeave"
                                        Background="White"
                                        BorderThickness="1">

                                            <Grid Margin="5">

                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition />
                                                </Grid.ColumnDefinitions>

                                                <StackPanel Grid.Column="0" >


                                                    <ContentControl  x:Name="ccNursingDiagnosis"
                                                ContentTemplate="{StaticResource ccTemplateDiagnosisAndIntervention}" 
                                                Foreground="{StaticResource DiagnosisColor}"
                                                HorizontalAlignment="Left"  />

                                                    <StackPanel x:Name="spShowOutcome" Orientation="Horizontal" Visibility="Collapsed">
                                                        <TextBlock Text="will" Margin="0,0,5,0" />
                                                        <TextBlock x:Name="tbShowOutcomeConcept" Text="{Binding Path=Concept, Converter={StaticResource RemoveParentesisOutcomeConceptConverter}}"  Foreground="{StaticResource DiagnosisColor}" />
                                                        <Image Margin="5,0,0,0" x:Name="imgOutcomeType" Height="15" VerticalAlignment="Center" />

                                                    </StackPanel>

                                                    <TextBlock Text="{dat:Binding Path=Text, ElementName=tbReasonDiagnosis, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 
														FontStyle="Italic" 
														TextWrapping="Wrap" HorizontalAlignment="Left"/>
                                                </StackPanel>
                                            </Grid>
                                        </Border>

                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition />
                                                <ColumnDefinition Width="25" />
                                            </Grid.ColumnDefinitions>

                                            <TextBox  Margin="0,5" 
										x:Name="tbReasonDiagnosis" VerticalAlignment="Stretch" 
										TextChanged="tbReasonDiagnosis_TextChanged" 
										ToolTip="Enter additional information about this diagnosis" 
										TextWrapping="Wrap"
										Grid.Column="0"
										/>

                                            <Button Grid.Column="1" x:Name="btnAcquireDiagnosticInformation" 
											HorizontalAlignment="Right" Height="20" Width="20" MaxWidth="25"   Click="btnAcquireDiagnosticInformation_Click">
                                                <Image Source="Images/Copy.png"  ToolTip="Copy selected aquired diagnostic information" />
                                            </Button>
                                        </Grid>


                                    </StackPanel>
                                </GroupBox>

                                <ListBox x:Name = "lbNursingDiagnosis"  
                                                 Margin="0,5,0,5"
						 	                    SelectionChanged="lbNursingDiagnosis_SelectionChanged"
							             MouseDoubleClick="lbNursingDiagnosis_MouseDoubleClick"
                                          MaxHeight="300"
                                        
                                         HorizontalAlignment="Left"
                                         IsSynchronizedWithCurrentItem="True"
                >

                                    <!-- <Label FontWeight="Bold">Sykepleie diagnoser</Label> -->

                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <TextBlock x:Name="tbConcept" Text ="{dat:Binding Path=Concept}" ToolTip="{dat:Binding Path=Definition}" Padding="5,0,0,0" />
                                            <DataTemplate.Triggers>
                                                <DataTrigger Binding="{dat:Binding Path=MinorCode}" Value="{x:Null}">
                                                    <Setter Property="FontWeight" TargetName="tbConcept" Value="Bold" />
                                                    <Setter Property="Padding" TargetName="tbConcept" Value="0" />
                                                </DataTrigger>
                                            </DataTemplate.Triggers>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                    <!--
            <ListBox.GroupStyle>
                <GroupStyle>
                    <GroupStyle.HeaderTemplate>
                        <DataTemplate>
                            <TextBlock FontWeight="Bold" FontSize="15"
                         Text="{Binding Path=Name}"/>
                        </DataTemplate>
                    </GroupStyle.HeaderTemplate>
                </GroupStyle>
            </ListBox.GroupStyle> -->
                                </ListBox>

                            </StackPanel>
                        </StackPanel>
                    </Expander>


                    <!-- Action Types -->

                    <!-- LANGAUGE attrib change-->

                    <Expander IsExpanded="False" >
                        <Expander.Header>
                            <TextBlock Text="Action type" Background="{StaticResource BrushFrameworkIntervention}" />
                        </Expander.Header>

                        <StackPanel Margin="5">

                            <Border PreviewMouseLeftButtonDown="ccActionType_MouseDown"
                                        MouseEnter="ccFrameworkElement_MouseEnter" 
                                        MouseLeave="ccFrameworkElement_MouseLeave"
                                        Background="White"
                                        BorderThickness="1">

                                <StackPanel Width="220"  HorizontalAlignment="Left">
                                    <TextBlock x:Name="tbConceptActionType"  HorizontalAlignment="Left"  FontWeight="UltraBold"
										 TextWrapping="Wrap" Foreground="{StaticResource InterventionColor}" />
                                    <TextBlock x:Name="tbDefinitionActionType" HorizontalAlignment="Left" TextWrapping="Wrap" />
                                </StackPanel>


                            </Border>

                            <ListBox x:Name = "lbActionType"  
                                                 Margin="0,5,0,5"
						 	                    MaxHeight="300"
                                         IsSynchronizedWithCurrentItem="True"
                                         HorizontalAlignment="Left"
                                         SelectionChanged="lbActionType_SelectionChanged"
                                                >


                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock  Text ="{dat:Binding Path=Concept}" ToolTip="{dat:Binding Path=Definition}" Padding="5,0,0,0" />
                                    </DataTemplate>
                                </ListBox.ItemTemplate>

                            </ListBox>

                            <StackPanel Orientation="Horizontal">
                                <ComboBox x:Name="cbActionType" Width="100"
								 ToolTip="Select an action type" 
								 SelectionChanged="cbActionType_SelectionChanged" 
								 IsEditable="True"  />


                                <CheckBox VerticalAlignment="Center" Margin ="5,0,0,0" x:Name="cbAttachToIntervention" 
                               Content="Attach to intervention" 
                                      IsChecked="False" Checked="cbAttachToIntervention_Checked"
                                      Unchecked="cbAttachToIntervention_UnChecked"/>

                            </StackPanel>




                        </StackPanel>

                    </Expander>

                    <!-- LANGAUGE attrib change-->

                    <Expander IsExpanded="True" >
                        <Expander.Header>
                            <TextBlock Text="Interventions" Background="{StaticResource BrushFrameworkIntervention}" />
                        </Expander.Header>

                        <StackPanel Margin="5">
                            <!-- LANGAUGE attrib change-->

                            <Label x:Name="lblNoMatchNursingInterventions" Visibility="Collapsed" Content="No interventions found!"/>
                            <StackPanel x:Name="spNursingInterventions">

                                <GroupBox Header="Description">
                                    <StackPanel Margin="5">

                                        <Border PreviewMouseLeftButtonDown="ccNursingIntervention_MouseDown"
                                        MouseEnter="ccFrameworkElement_MouseEnter" 
                                        MouseLeave="ccFrameworkElement_MouseLeave"
                                        Background="White"
                                        BorderThickness="1">

                                            <StackPanel  Margin="5"  Background="White" >
                                                <Grid>
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="0" x:Name="gcActionType" />
                                                        <ColumnDefinition />
                                                    </Grid.ColumnDefinitions>

                                                    <TextBlock x:Name="tbNursingInterventionActionModifier" 
                                    Margin="0,0,5,0"
                                     Foreground="{StaticResource InterventionColor}" 
                                     Visibility="Collapsed" Grid.Column="0" />

                                                    <TextBlock x:Name="tbNursingInterventionConcept" TextWrapping="Wrap" 
									FontWeight="UltraBold" 
									Foreground="{StaticResource InterventionColor}"
									Grid.Column="1" />
                                                </Grid>

                                                <TextBlock
							         Text="{dat:Binding Path=Text, ElementName=tbReasonIntervention, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" 
														FontStyle="Italic"
														 TextWrapping="Wrap"
													
														 />
                                            </StackPanel>

                                        </Border>

                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition />
                                                <ColumnDefinition Width="25" />
                                            </Grid.ColumnDefinitions>
                                            <TextBox Grid.Column="0" 
											Margin="0,5" 
											 x:Name="tbReasonIntervention" 
											TextChanged="tbReasonIntervention_TextChanged" 
											ToolTip="Enter additional information about this intervention" 
											TextWrapping="Wrap"/>

                                            <Button Grid.Column="1" x:Name="btnAcquireInterventionalInformation" 
				   							  HorizontalAlignment="Right" Height="20" Width="20" MaxWidth="25"   Click="btnAcquireInterventionalInformation_Click">
                                                <Image Source="Images/Copy.png"  ToolTip="Copy selected aquired interventional information" />
                                            </Button>
                                        </Grid>

                                    </StackPanel>
                                </GroupBox>

                                <ListBox x:Name = "lbNursingInterventions"  
                                         Margin="5"
						 	             SelectionChanged="lbNursingInterventions_SelectionChanged"
							             MouseDoubleClick="lbNursingInterventions_MouseDoubleClick"
                                         MaxHeight="300" 
                                         HorizontalAlignment="Left"
                                         IsSynchronizedWithCurrentItem="True"
                                         >


                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <TextBlock x:Name="tbConceptIntervention" Text ="{dat:Binding Path=Concept}" ToolTip="{dat:Binding Path=Definition}" Padding="5,0,0,0" />
                                            <DataTemplate.Triggers>
                                                <DataTrigger Binding="{dat:Binding Path=MinorCode}" Value="{x:Null}">
                                                    <Setter Property="FontWeight" TargetName="tbConceptIntervention" Value="Bold" />
                                                    <Setter Property="Padding" TargetName="tbConceptIntervention" Value="0" />
                                                </DataTrigger>
                                            </DataTemplate.Triggers>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                    <!--
            <ListBox.GroupStyle>
                <GroupStyle>
                    <GroupStyle.HeaderTemplate>
                        <DataTemplate>
                            <TextBlock FontWeight="Bold" FontSize="15"
                         Text="{Binding Path=Name}"/>
                        </DataTemplate>
                    </GroupStyle.HeaderTemplate>
                </GroupStyle>
            </ListBox.GroupStyle> -->
                                </ListBox>
                            </StackPanel>
                        </StackPanel>

                    </Expander>
                </StackPanel>


            </Expander>

        </StackPanel>
    </ScrollViewer>
</UserControl>
